<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>

	
	<head>

		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">

		<title>后台 - 登录</title>
		<meta name="keywords" content="">
		<meta name="description" content="">

		<link rel="shortcut icon" href="favicon.ico">
		<link href="/voting_backstage/Public/Admin/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
		<link href="/voting_backstage/Public/Admin/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">

		<link href="/voting_backstage/Public/Admin/css/animate.min.css" rel="stylesheet">
		<link href="/voting_backstage/Public/Admin/css/style.min862f.css?v=4.1.0" rel="stylesheet">
		
		<script>
			if(window.top !== window.self) {
				window.top.location = window.location;
			}
		</script>
	</head>

	<body class="gray-bg">

		<div class="middle-box text-center loginscreen  animated fadeInDown">
			<div>
				<h2>投票管理后台登录</h2>
				<form class="m-t" role="form" method="post" action="<?php echo U('Admin/Login/login');?>" id="LoginForm" name="LoginForm"  autocomplete="off">
					<div class="form-group">
						<input type="text" id="username" name="username" class="form-control" placeholder="用户名" required autocomplete="off" >
					</div>
					<div class="form-group">
						<input type="password" id="password" name="password" class="form-control" placeholder="密码" required autocomplete="off">
					</div>
					<div class="form-group">
						<input type="text" id="verify" name="verify" class="form-control" placeholder="请填写四位验证码" required>
						<a href="javascript:void(0)" class="reloadverify" title="换一张">换一张？</a><span class="Validform_checktip"></span><br>
						<img class="verifyimg reloadverify" src="<?php echo U('Login/verify');?>" alt="点击切换">
					</div>

					<button type="submit" class="btn btn-primary block full-width m-b">登 录</button>
				</form>
			</div>
		</div>
		<script src="/voting_backstage/Public/Admin/js/jquery.min.js?v=2.1.4"></script>
		<script src="/voting_backstage/Public/Admin/js/bootstrap.min.js?v=3.3.6"></script>
		
		<script src="/voting_backstage/Public/Common/js/ajaxForm.js"></script>
		<script src="/voting_backstage/Public/layer/layer.js"></script>
		
		<script>
			$(function(){
				$('#LoginForm').ajaxForm({
					beforeSubmit: checkForm,
					success: complete, 
					dataType: 'json'
				});
				function checkForm(){
					if( '' == $.trim($('#username').val())){
						layer.alert('用户名不能为空', {icon: 5}, function(index){
			 				layer.close(index);
							$('#username').focus();
						});
						return false;
					}
					if( '' == $.trim($('#password').val())){
						layer.alert('密码不能为空', {icon: 5}, function(index){
			 				layer.close(index);
							$('#password').focus();
						});
						return false;
					}
                    if( '' == $.trim($('#verify').val())){
                        layer.alert('请输入验证码', {icon: 5}, function(index){
                            layer.close(index);
                            $('#verify').focus();
                        });
                        return false;
                    }
				}

				function complete(data){
					if(data.status==1){
						$('.btn').attr('disabled','disabled');
						layer.msg(data.info, function(index){
			 				layer.close(index);
							window.location.href=data.url;
						});
					}else{
						layer.msg(data.info);
						$('#password').val('').focus();
						return false;

				}}
			});
		</script>
	</body>
</html>